package main

import "fmt"

func numOperations(a, b int) {
	fmt.Println(a + b)
	fmt.Println(a - b)
	fmt.Println(a * b)
	fmt.Println(a / b)
	fmt.Println(a % b)
}

//字符串拼接
func stringOperation(a, b string) {
	fmt.Println("a和b拼接后", a+b)
}

func stringSprintf(firstName, secondName string) {
	fullName := secondName + firstName //返回拼接后的字符串
	fmt.Println(fullName)

}
func main() {

	// 数值运算
	i1 := 5
	i2 := 10
	fmt.Println(i1 + i2)
	numOperations(i1, i2)
	name1 := "yangxu"
	name2 := "mahong"
	stringOperation(name1, name2)
	stringOperation("1", "2")
	stringSprintf("zhaoyang", "66666")
	// 字符串拼接
	//fmt.Sprintf() 格式化输出并返回拼接后的字符串
	//fmt.Println() 直接输出到控制台
	var namezhao string = fmt.Sprintf("Name %s, Age: %d", "zhaoyang", 18)
	fmt.Println(namezhao)
	//strings.Join() 拼接字符串
	//strings.Join([]string{"Name", "Age"}, " ")
	//自增和自减
	p1 := 1
	p1++
	p1--
	fmt.Println(p1)
}
